var cheerio = require('cheerio'),
	urlencode = require('urlencode'),
	request = require('request'),
	url = '',
	date = new Array();

module.exports.getssss = function(text, callback){
	var code = urlencode(text)
	request({
			method:'GET',
			url:'http://m.sm.cn/s?tomode=center&q=site%3Apan.baidu.com%20'+code+'&page=1',
			headers: {
				'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0',
				'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
			}
		}, function(err, res, body){
			if (err) {
				return err
			} else {

				$ = cheerio.load(body);
				$('.article').each(function(i, e){
					url += $(this).html();
				})
				
			    callback(url);
			    url = ''
			}
		}
	);
}